package com.the4man.framework.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import org.apache.struts2.ServletActionContext;

/**
 * Created by lenovo on 2017/12/12.
 */
public class EncodingInterceptor extends AbstractInterceptor {
    public EncodingInterceptor() {
    }

    public String intercept(ActionInvocation invocation) throws Exception {
        ServletActionContext.getResponse().setCharacterEncoding("utf-8");
        ServletActionContext.getRequest().setCharacterEncoding("utf-8");
        return invocation.invoke();
    }
}
